package com.fc.test.api;

import com.fc.test.model.auto.TAbbKefu;
import com.fc.test.service.TAbbKefuService;
import com.fc.test.util.JsonUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping(value = "apiKefuController")
@Api(value = "客服")
public class ApiKefuController {

    @Autowired
    private TAbbKefuService kefuService;

    @ResponseBody
    @PostMapping(value="getKefuList",produces = {"application/json; charset=utf-8"})
    @ApiOperation(value = "获取客服电话")
    public String getKefuList(){
        Map<String,Object> resMap = new HashMap<>();
        List<TAbbKefu> list = kefuService.getKefuList();
        if(list.size()>0){
           resMap.put("success",true);
           resMap.put("msg","获取客服电话成功");
           resMap.put("list",list);
        }else{
            resMap.put("success",false);
            resMap.put("msg","没有客服电话");
        }
        return JsonUtil.jsonMapStr(resMap);
    }
}
